#include <stdio.h>
#include <stdint.h>
#include <inttypes.h>

typedef int64_t num_t;
#define num_sch SCNd64
#define num_pph PRId64

void logic(num_t number) {
    if (number < 2) {
        printf("%" num_pph "\n", number);
        return;
    }
    num_t now = 2;
    int count = 0;
    while (number != 1 || count != 0) {
        if (number % now != 0 || (number == 1 && count != 0)) {
            if (count != 0) {
                if (count > 1) {
                    printf("%" num_pph "^%d", now, count);
                } else {
                    printf("%" num_pph, now);
                }
                if (number == 1) {
                    putchar('\n');
                } else {
                    putchar('*');
                }
            } else {
                if (now * now >= number) {
                    printf("%" num_pph "\n", number);
                    break;
                }
            }
            count = 0;
            now++;
        } else {
            number /= now;
            count++;
        }
    }
}

int main(void) {
    num_t number;
    while (scanf(" %" num_sch, &number) != EOF) {
        logic(number);
    }
    return 0;
}
